package com.zte.springboot_smbms.service.impl;


import com.zte.springboot_smbms.mapper.SmbmsAddressMapper;
import com.zte.springboot_smbms.pojo.SmbmsAddress;
import com.zte.springboot_smbms.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private SmbmsAddressMapper smbmsAddressMapper;
    @Override
    @Transactional(readOnly = true)
    public List<SmbmsAddress> findAllAddress() {
        return smbmsAddressMapper.findAllAddress();
    }

    @Override
    @Transactional(readOnly = true)
    public List<SmbmsAddress> findAddressById(Long id) {
        return smbmsAddressMapper.findAddressById(id);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean addAddress(SmbmsAddress address) {
        return smbmsAddressMapper.addAddress(address);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean delAddress(Long id) {
        return smbmsAddressMapper.delAddress(id);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean updateAddress(Long id, SmbmsAddress address) {
        return smbmsAddressMapper.updateAddress(id,address);
    }
}
